3 minutes cassandra2.1

cassandra 2.1以上版本採用backlog日誌

vi conf/logback.xm
bin/cassandra -fl
bin/cqlsh

create keyspace

create keyspace mykeyspace with replication={‘class’:’SimpleStrategy’,’replication_factor’:1}
use mykeyspace;

create table

create table users(user_id int primary key,fname text,lname text);
insert into users (user_id,fname,lname) values(1,’john’,’smith’);
insert into users (user_id,fname,lname) values(3,’3’,’chang’);
insert into users (user_id,fname,lname) values(1,’john’,’smith’);
insert into users (user_id,fname,lname) values(3,’john’,’smith’);

select

select * from users where user_id=2;

create index

create index on users(lname);
select from users where lname=’chang’;
select
from users where lname=’smith’;

exit cqlsh

ctrl+D 結束